<template>
  <div class=''>
    <div class="about">
      <div class="swiper-container">
        <div class="swiper-wrapper">
          <div class="swiper-slide" v-for="(item,index) of swiperList" :key="index" @click="handler(item)">{{ item }}</div>
        </div>
        <!-- 如果需要分页器 -->
        <div class="swiper-pagination"></div>
        <!-- 如果需要导航按钮 -->
        <div class="swiper-button-prev"></div>
        <div class="swiper-button-next"></div>

        <!-- 如果需要滚动条 -->
        <!--    <div class="swiper-scrollbar"></div>-->
      </div>

      <div class="swiper-pagination"></div>

    </div>
  </div>
</template>

<script>
import 'swiper/css/swiper.min.css'
import 'swiper/js/swiper.min'
import Swiper from 'swiper'
export default {
  props: {},
  name: 'swiperChart',
  data() {
    return {
      swiperList: [
        1, 2, 3, 4
      ]
    }
  },
  components: {},
  created() { },
  mounted() {
    var swiper = new Swiper('.swiper-container', {
      slidesPerView: 3,
      spaceBetween: 30,
      centeredSlides: false,
      loop: false,
      pagination: {
        el: '.swiper-pagination',
        clickable: true
      },
      on: {
        paginationUpdate() {
          console.log(arguments)
        }
      }
    })

    console.log(swiper)
  },
  methods: {
    handler(item) {
      console.log(item)
    }
  },
  watch: {},
  computed: {}
}
</script>

<style lang="less" scoped>

.swiper-container {
  width: 100vw;
  height: 100vh;
}

.swiper-slide {
  text-align: center;
  font-size: 18px;
  background: #fff;

  /* Center slide text vertically */
  display: -webkit-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  display: flex;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  -webkit-box-align: center;
  -ms-flex-align: center;
  -webkit-align-items: center;
  align-items: center;
  transition: 300ms;
  transform: scale(0.8);
}

.swiper-slide-active,
.swiper-slide-duplicate-active {
  transform: scale(0.9);
}</style>
